package com.maxd.modules.syslog.service.impl;

import com.maxd.error.Result;
import com.maxd.error.ResultUtil;
import com.maxd.modules.syslog.entity.RequestLogs;
import com.maxd.modules.syslog.mapper.RequestLogsMapper;
import com.maxd.modules.syslog.service.RequestLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Auther: Laban:yubo_010@163.com
 * @Date: 2020/11/18 09:35
 * @Description:
 */
@Service
public class RequestLogsServiceImpl implements RequestLogsService {


    @Autowired
    private RequestLogsMapper requestLogsMapper;


    @Override
    public Result findAll(RequestLogs requestLogs, Pageable pageable) {
        Example<RequestLogs> example1 = Example.of(requestLogs);
        return ResultUtil.success(requestLogsMapper.findAll(example1,pageable));
    }

    @Override
    @Transactional
    public void saveRequestLogs(RequestLogs requestLog) {
        requestLogsMapper.save(requestLog);
    }
}
